package com.tuqu.asynctask;

public class TAsyncTask extends TqAsyncTask<Object, Void, Object> {

	
	private static final int DEFAULT_TASK_ID = 10000;

	private int mTaskID;

	private AsyncTaskListener mAsyncTaskListener;

	public int getTaskID() {
		return mTaskID;
	}

	public void setTaskID(int taskID) {
		this.mTaskID = taskID;
	}
	
	

	public TAsyncTask(
			AsyncTaskListener asyncTaskListener) {
		this(DEFAULT_TASK_ID ,asyncTaskListener);
		
		
	}

	public TAsyncTask(int taskID,
			AsyncTaskListener asyncTaskListener) {
		super();

		this.mAsyncTaskListener = asyncTaskListener;
		setTaskID(taskID);
		
	}

	@Override
	void onBeforeTask() {
		// TODO Auto-generated method stub
		mAsyncTaskListener.onBeforeTask(mTaskID);
	}

	@Override
	Object onTask(Object... params) throws Exception {
		// TODO Auto-generated method stub
		return mAsyncTaskListener.onTask(mTaskID, params);
	}

	@Override
	void onAfterTask(Object result) {
		// TODO Auto-generated method stub
		mAsyncTaskListener.onAfterTask(mTaskID, result);
	}

	@Override
	void onTaskError(Exception exception) {
		// TODO Auto-generated method stub
		mAsyncTaskListener.onTaskError(mTaskID, exception);
	}
	
	
	

	
}
